#!/bin/bash
clear
echo -e "\nRunning lex..."
lex lex.l
echo -e "lex ran successfully!\n"
echo -e "Running yacc..."
yacc -d yacc.y
echo -e "yacc ran succesfully!\n"
echo -e "Getting Object Files from lex.yy.c and y.tab.c...\nFollowing are the list of warnings + errors (if any) from gcc:"
gcc -c lex.yy.c y.tab.c
echo -en "\ncontinue linking?(y/n)"
read x
if [ $x == 'y' ];
then
   echo -e "\nLinking.."
   gcc -o docterific lex.yy.o y.tab.o -ll;
   echo "docterific generated :)"
   rm *.o
   rm *.c
   rm *.h
fi
